package my.edu.security.userEntity;

import cn.hutool.jwt.JWT;
import org.springframework.beans.factory.annotation.Value;

import java.util.Map;

public class JWTToken {
    public static final String USER_ID = "userId";


    public static Map<String,Object> getUserJWTMap(Long userId){
        String jwt = JWT.create()
                .setPayload(USER_ID, userId)
                .setKey(UserToken.TOKEN_SALT.getBytes())
                .sign();
        return Map.of("token",jwt);
    }

    public static String getUserJWTString(Long userId){
        return  JWT.create()
                .setPayload(USER_ID, userId)
                .setKey(UserToken.TOKEN_SALT.getBytes())
                .sign();
    }
}
